package com.witte.serviceImp;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.witte.dao.DdDataMapper;
import com.witte.dao.DdShowMapper;
import com.witte.entity.DdData;
import com.witte.entity.DdShow;
import com.witte.service.DdService;

@Service
public class DdServiceImp implements DdService{
	
	@Autowired
	DdShowMapper dd;
	
	@Autowired
	DdDataMapper ddData;

	@Override
	public List<DdShow> selectByType(String type) {
		List<DdShow> list= dd.selectByType(type);
		return list;
	}

	@Override
	public List<DdData> selectByParentId(int parentId) {
		List<DdData> list= ddData.selectByParentId(parentId);
		return list;
	}

	@Override
	public int add(DdData data) {
		data.setCreatetime(new Date());
		return ddData.insertSelective(data);
	}

	@Override
	public int edit(DdData data) {
		data.setModififytime(new Date());
		return ddData.updateByPrimaryKeySelective(data);
	}

	@Override
	public int delete(DdData data) {
		// TODO 自动生成的方法存根
		return ddData.deleteByPrimaryKey(data.getId());
	}
	
}
